<template>
	<view class="home">
		<view class="out">
			<view class="row" v-for="item in listArr" :key="item.id">姓名：{{item.name}}</view>
			
			<button @click="onUpdate">修改</button>
			<button type="warn" @click="onRemove">删除</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				listArr: []
			}
		},
		onLoad() {
			this.getData()
		},
		methods: {
			getData() {
				uniCloud.callFunction({
					name: 'cloudDemoGet',
					data: {
						keyword: '小'
					}
				}).then(res => {
					console.log(res, 'res')
					this.listArr = res.result.data
				})
			},
			onUpdate() {
				uniCloud.callFunction({
					name: 'cloudDemoUpdate'
				}).then(res => {
					console.log(res, 'res')
				})
			},
			onRemove() {
				uniCloud.callFunction({
					name: 'cloudDemoRemove'
				}).then(res => {
					console.log(res, 'res')
				})
			}
		}
	}
</script>

<style lang="scss">
	.out {
		padding: 30upx;
		.row {
			border-bottom: 1px solid #cccccc;
			padding: 20upx 0;
		}
	}
</style>
